home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / Fonts.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  7.7 KB  |  248 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Monday, January 28, 1991 at 4:48 PM
  3.     Fonts.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc.    1985-1990
  7.         All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT Fonts;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingFonts}
  21. {$SETC UsingFonts := 1}
  22.  
  23. {$I+}
  24. {$SETC FontsIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingTypes}
  27. {$I $$Shell(PInterfaces)Types.p}
  28. {$ENDC}
  29. {$IFC UNDEFINED UsingQuickdraw}
  30. {$I $$Shell(PInterfaces)Quickdraw.p}
  31. {$ENDC}
  32. {$SETC UsingIncludes := FontsIncludes}
  33.  
  34. CONST
  35. systemFont = 0;
  36. applFont = 1;
  37. newYork = 2;
  38. geneva = 3;
  39. monaco = 4;
  40. venice = 5;
  41. london = 6;
  42. athens = 7;
  43. sanFran = 8;
  44. toronto = 9;
  45. cairo = 11;
  46. losAngeles = 12;
  47. times = 20;
  48. helvetica = 21;
  49. courier = 22;
  50. symbol = 23;
  51. mobile = 24;
  52. commandMark = 17;
  53. checkMark = 18;
  54. diamondMark = 19;
  55. appleMark = 20;
  56. propFont = 36864;
  57. prpFntH = 36865;
  58. prpFntW = 36866;
  59. prpFntHW = 36867;
  60. fixedFont = 45056;
  61. fxdFntH = 45057;
  62. fxdFntW = 45058;
  63. fxdFntHW = 45059;
  64. fontWid = 44208;
  65.  
  66. TYPE
  67. FMInput = PACKED RECORD
  68.     family: INTEGER;
  69.     size: INTEGER;
  70.     face: Style;
  71.     needBits: BOOLEAN;
  72.     device: INTEGER;
  73.     numer: Point;
  74.     denom: Point;
  75.     END;
  76.  
  77. FMOutPtr = ^FMOutput;
  78. FMOutput = PACKED RECORD
  79.     errNum: INTEGER;
  80.     fontHandle: Handle;
  81.     bold: Byte;
  82.     italic: Byte;
  83.     ulOffset: Byte;
  84.     ulShadow: Byte;
  85.     ulThick: Byte;
  86.     shadow: Byte;
  87.     extra: SignedByte;
  88.     ascent: Byte;
  89.     descent: Byte;
  90.     widMax: Byte;
  91.     leading: SignedByte;
  92.     unused: Byte;
  93.     numer: Point;
  94.     denom: Point;
  95.     END;
  96.  
  97. FontRec = RECORD
  98.     fontType: INTEGER;                      {font type}
  99.     firstChar: INTEGER;                     {ASCII code of first character}
  100.     lastChar: INTEGER;                      {ASCII code of last character}
  101.     widMax: INTEGER;                        {maximum character width}
  102.     kernMax: INTEGER;                       {negative of maximum character kern}
  103.     nDescent: INTEGER;                      {negative of descent}
  104.     fRectWidth: INTEGER;                    {width of font rectangle}
  105.     fRectHeight: INTEGER;                   {height of font rectangle}
  106.     owTLoc: INTEGER;                        {offset to offset/width table}
  107.     ascent: INTEGER;                        {ascent}
  108.     descent: INTEGER;                       {descent}
  109.     leading: INTEGER;                       {leading}
  110.     rowWords: INTEGER;                      {row width of bit image / 2 }
  111.     END;
  112.  
  113. FMetricRec = RECORD
  114.     ascent: Fixed;                          {base line to top}
  115.     descent: Fixed;                         {base line to bottom}
  116.     leading: Fixed;                         {leading between lines}
  117.     widMax: Fixed;                          {maximum character width}
  118.     wTabHandle: Handle;                     {handle to font width table}
  119.     END;
  120.  
  121. WidEntry = RECORD
  122.     widStyle: INTEGER;                      {style entry applies to}
  123.     END;
  124.  
  125. WidTable = RECORD
  126.     numWidths: INTEGER;                     {number of entries - 1}
  127.     END;
  128.  
  129. AsscEntry = RECORD
  130.     fontSize: INTEGER;
  131.     fontStyle: INTEGER;
  132.     fontID: INTEGER;                        {font resource ID}
  133.     END;
  134.  
  135. FontAssoc = RECORD
  136.     numAssoc: INTEGER;                      {number of entries - 1}
  137.     END;
  138.  
  139. StyleTable = RECORD
  140.     fontClass: INTEGER;
  141.     offset: LONGINT;
  142.     reserved: LONGINT;
  143.     indexes: ARRAY [0..47] OF SignedByte;
  144.     END;
  145.  
  146. NameTable = RECORD
  147.     stringCount: INTEGER;
  148.     baseFontName: Str255;
  149.     END;
  150.  
  151. KernPair = RECORD
  152.     kernFirst: CHAR;                        {1st character of kerned pair}
  153.     kernSecond: CHAR;                       {2nd character of kerned pair}
  154.     kernWidth: INTEGER;                     {kerning in 1pt fixed format}
  155.     END;
  156.  
  157. KernEntry = RECORD
  158.     kernLength: INTEGER;                    {length of this entry}
  159.     kernStyle: INTEGER;                     {style the entry applies to}
  160.     END;
  161.  
  162. KernTable = RECORD
  163.     numKerns: INTEGER;                      {number of kerning entries}
  164.     END;
  165.  
  166. WidthTable = PACKED RECORD
  167.     tabData: ARRAY [1..256] OF Fixed;       {character widths}
  168.     tabFont: Handle;                        {font record used to build table}
  169.     sExtra: LONGINT;                        {space extra used for table}
  170.     style: LONGINT;                         {extra due to style}
  171.     fID: INTEGER;                           {font family ID}
  172.     fSize: INTEGER;                         {font size request}
  173.     face: INTEGER;                          {style (face) request}
  174.     device: INTEGER;                        {device requested}
  175.     inNumer: Point;                         {scale factors requested}
  176.     inDenom: Point;                         {scale factors requested}
  177.     aFID: INTEGER;                          {actual font family ID for table}
  178.     fHand: Handle;                          {family record used to build up table}
  179.     usedFam: BOOLEAN;                       {used fixed point family widths}
  180.     aFace: Byte;                            {actual face produced}
  181.     vOutput: INTEGER;                       {vertical scale output value}
  182.     hOutput: INTEGER;                       {horizontal scale output value}
  183.     vFactor: INTEGER;                       {vertical scale output value}
  184.     hFactor: INTEGER;                       {horizontal scale output value}
  185.     aSize: INTEGER;                         {actual size of actual font used}
  186.     tabSize: INTEGER;                       {total size of table}
  187.     END;
  188.  
  189. FamRec = RECORD
  190.     ffFlags: INTEGER;                       {flags for family}
  191.     ffFamID: INTEGER;                       {family ID number}
  192.     ffFirstChar: INTEGER;                   {ASCII code of 1st character}
  193.     ffLastChar: INTEGER;                    {ASCII code of last character}
  194.     ffAscent: INTEGER;                      {maximum ascent for 1pt font}
  195.     ffDescent: INTEGER;                     {maximum descent for 1pt font}
  196.     ffLeading: INTEGER;                     {maximum leading for 1pt font}
  197.     ffWidMax: INTEGER;                      {maximum widMax for 1pt font}
  198.     ffWTabOff: LONGINT;                     {offset to width table}
  199.     ffKernOff: LONGINT;                     {offset to kerning table}
  200.     ffStylOff: LONGINT;                     {offset to style mapping table}
  201.     ffProperty: ARRAY [1..9] OF INTEGER;    {style property info}
  202.     ffIntl: ARRAY [1..2] OF INTEGER;        {for international use}
  203.     ffVersion: INTEGER;                     {version number}
  204.     END;
  205.  
  206.  
  207. PROCEDURE InitFonts;
  208.     INLINE $A8FE;
  209. PROCEDURE GetFontName(familyID: INTEGER;VAR name: Str255);
  210.     INLINE $A8FF;
  211. PROCEDURE GetFNum(name: Str255;VAR familyID: INTEGER);
  212.     INLINE $A900;
  213. FUNCTION RealFont(fontNum: INTEGER;size: INTEGER): BOOLEAN;
  214.     INLINE $A902;
  215. PROCEDURE SetFontLock(lockFlag: BOOLEAN);
  216.     INLINE $A903;
  217. FUNCTION FMSwapFont(inRec: FMInput): FMOutPtr;
  218.     INLINE $A901;
  219. PROCEDURE SetFScaleDisable(fscaleDisable: BOOLEAN);
  220.     INLINE $A834;
  221. PROCEDURE FontMetrics(theMetrics: FMetricRec);
  222.     INLINE $A835;
  223. PROCEDURE SetFractEnable(fractEnable: BOOLEAN);
  224. FUNCTION IsOutline(numer: Point;denom: Point): BOOLEAN;
  225.     INLINE $7000,$A854;
  226. PROCEDURE SetOutlinePreferred(outlinePreferred: BOOLEAN);
  227.     INLINE $7001,$A854;
  228. FUNCTION GetOutlinePreferred: BOOLEAN;
  229.     INLINE $7009,$A854;
  230. FUNCTION OutlineMetrics(byteCount: INTEGER;textPtr: UNIV Ptr;numer: Point;
  231.     denom: Point;VAR yMax: INTEGER;VAR yMin: INTEGER;awArray: FixedPtr;lsbArray: FixedPtr;
  232.     boundsArray: RectPtr): OSErr;
  233.     INLINE $7008,$A854;
  234. PROCEDURE SetPreserveGlyph(preserveGlyph: BOOLEAN);
  235.     INLINE $700A,$A854;
  236. FUNCTION GetPreserveGlyph: BOOLEAN;
  237.     INLINE $700B,$A854;
  238. FUNCTION FlushFonts: OSErr;
  239.     INLINE $700C,$A854;
  240.  
  241.  
  242. {$ENDC}    { UsingFonts }
  243.  
  244. {$IFC NOT UsingIncludes}
  245.     END.
  246. {$ENDC}
  247.  
  248.